package com.zqh.myfmmall.fallback;

import com.zqh.myfmmall.clients.OrderItemSaveClient;
import com.zqh.myfmmall.result.Result;
import com.zqh.myfmmall.rowbeans.entity.OrderItem;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * @Description :
 * @Author :kono淇杭哒、
 * @Create 2022-03-17 11:10
 */
@Slf4j
public class OrderItemSaveClientFallback implements FallbackFactory<OrderItemSaveClient>{
    @Override
    public OrderItemSaveClient create(Throwable cause) {
        log.warn("exception in calling orderitemsave service:"+cause);
        return new OrderItemSaveClient(){
            @Override
            public Result create(OrderItem orderItem) {
                return Result.internalServerError();
            }

            @Override
            public Result createBatch(List<OrderItem> orderItems) {
                return Result.internalServerError();
            }
        };
    }
}
